@echo off

rem 设置UTF-8编码
chcp 65001
set JAVA_OPTS=-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8

rem 创建logs目录
if not exist "logs" mkdir "logs"

rem 启动应用程序
java %JAVA_OPTS% -jar target\eureka-server-1.0.0.jar > logs\eureka-server.log 2>&1 &

rem 记录进程ID到文件
for /f "tokens=2" %%i in ('tasklist /nh /fi "imagename eq java.exe" /v ^| findstr "eureka-server-1.0.0.jar"') do (
    echo %%i > pid.txt
    echo 服务已启动，进程ID: %%i
)

rem 暂停显示信息
pause